<!DOCTYPE html>
<html lang="en"  xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>用户管理</title>
</head>

<body>

<h3 style="color: green">用户管理</h3>
<table border="1">
    <tr>
        <td>序号</td><td>ID</td><td>用户名</td><td>密码</td><td>性别</td><td>生日</td><td>操作</td>
    </tr>
    <!-- thymeleaf 循环 -->
    <!-- user:循环的变量名 -->
    <!-- userStat:一般用法变量名+stat 用来获取序号、是否是第一行、最后一行、奇偶行 -->
    <!-- users:数据 -->
    <tr th:each="user,userStat:${users}">
        <td th:text="${userStat.count}" th:if="${userStat.odd}" style="background-color: gold"></td>
        <td th:text="${userStat.count}" th:if="${userStat.even}" style="background-color: red"></td>
        <td th:text="${user.id}" th:if="${userStat.first}" style="background-color: blueviolet"></td>
        <td th:text="${user.id}" th:if="${userStat.first==false}" ></td>
        <td th:text="${user.userName}"></td>
        <td th:text="${user.password}"></td>
        <td th:text="${user.sex==1?'男':'女'}"></td>
        <td th:text="${#dates.format(user.birthday,'yyyy-MM-dd HH:mm:ss')}"></td>
        <td>
            <a th:href="@{/user/updateById(id=${user.id})}">编辑</a> |
            <a th:href="@{/user/deleteById(id=${user.id})}">删除</a>
        </td>
    </tr>
    <tr>
        <td colspan="7">
            <a >首页</a>
            <a >上一页</a>
            <a >下一页</a>
            <a >尾页</a>
        </td>
    </tr>
</table>
</body>

</html>